/**
 * 查找窗口
 */
$(document).ready(function(){
	
	/**
	 * 初始化下拉框
	 */
	$("#searchType").combobox({
		data: [{
			"value" : "StringField",
			"text" : "StringField"
		},{
			"value"  : "IntField",
			"text" : "IntField"
		},{
			"value" : "TextField",
			"text" : "TextField"
		},{
			"value" : "LongField",
			"text" : "LongField"
		}],
		value: "StringField",
		panelHeight: "auto",//设置容器高度自动增长
		editable: false
	});
	
	/**
	 * 修改窗口
	 */
	$("#searchWindow").window({
		title : "查找",
		collapsible: false,
		minimizable: false,
		closed: true,
		modal : true,
		top: 80,
		icon: "icon-search"
	})
});

/**
 * 提交查询
 */
var searchData = function(){
	var fieldName = $("#searchName").val();
	var fieldType = $("#searchType").combobox("getValue");
	var keyword = $("#searchKeyword").val();
	var endRange = $("#endRange").val();
	
	$("#allData").datagrid("load",{
		"queryAttr.fieldName": fieldName,
		"queryAttr.fieldType": fieldType,
		"queryAttr.keyword": keyword,
		"queryAttr.endRange": endRange
	});

	$("#searchWindow").window("close");
	
	$("#allData").datagrid("getPanel").panel("setTitle","lucene数据（查询字段：" + fieldName + " | 字段类型：" + fieldType + " | 关键字：" + keyword + " | 范围结束值：" + endRange + "）");
}





